<?php
require_once ('conn.php');
require_once ('top.php');
if($_SESSION['role']==2){
      Header("Location:supply_index.php"); 
   }elseif($_SESSION['role']==3){
           Header("Location:dotlistMaster.php"); 
   }
$result=mysql_query("select * from ci_contact where disable=0 and isDelete=0 and staffid=".$_SESSION['userid']); 
    $i=0;
    $Total;//总库存
    $Surplus;//当前库存
    $num;//交易额
    $num=0;
    while($row=mysql_fetch_array($result)) 
    {
        
        $result2=mysql_query("select num,goodsPrice from ci_wx_order_goods where customerNumber ='".$row['number']."'  and payStatus = 1");
        
        while($n=mysql_fetch_array($result2)) 
        {
            $num=$num+$n[0]*$n[1];
        }
     $i++;
    }

?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>优易购</title>
    <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no">
    <link rel="stylesheet" type="text/css" href="css/style.css">
    <script src="js/jquery-1.11.0.min.js"></script>
</head>
<script>
function showTime(){
    nowtime=new Date();
    year=nowtime.getFullYear();
    month=nowtime.getMonth()+1;
    date=nowtime.getDate();
    document.getElementById("mytime").innerText=year+"年"+month+"月"+date;
}    
    setInterval("showTime()");
</script>
<body>
    <div class="top">
        <a href="newwd.php"><div class="tleft">+ 新增网点</div></a>
        <span>市场人员 - 首页</span>
        <div class="tright"><span class="outlogin">退出登陆</span></div>
    </div>
    <div class="bodybut">
        <div class="rili">
            <img src="img/rl.png" alt="">
            <span id="mytime"></span>
        </div>
        <div class="lan">
            <p class="shuzi">--</p>
            <p>当月成本</p>
        </div>
        <div class="huang">
            <p class="shuzi">--</p>
            <p>当月余额</p>
        </div>
        <div class="zi">
            <p class="shuzi"><?=$num?></p>
            <p>当月交易额</p>
        </div>
        <div class="lv">
            <p class="shuzi">--</p>
            <p>当月利润</p>
        </div>
        <a href="market.php">
        <div class="pandian">
            <img src="img/pandian.png" alt="">
            全部盘点（<?=$i?>）
        </div>
        </a>
    </div>
    <div style=" width:100%;height:100px; float:left;"></div>
    <div class="foot">
       
        <div class="footon">
        <img src="img/f1.png" alt="">
        <p>首页数据</p>
        </div>
        
        <a href="market.php">
        <div>
        <img src="img/f22.png" alt="">
        <p>全部网点</p>
        </div>
        </a>
        
        <a href="#">
        <div>
        <img src="img/f33.png" alt="">
        <p>补货记录</p>
        </div>
        </a>
    </div>
</body>
<script src="js/outlogin.js"></script>
</html>